home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freelog Special Freeware 31
/
FreelogHS31.iso
/
ArgentCompta
/
FASTCAISSE
/
Setup FASTCAISSE.exe
/
{app}
/
A faire73.sql
< prev
next >
Wrap
Text File
|
2006-10-23
|
15KB
|
528 lines
ALTER TABLE ARTICLES ADD RETOUR VARCHAR(18);
ALTER TABLE LIGNES ADD MARGE DECIMAL(14,6);
ALTER TABLE ARTICLES ADD TYPEMARGE SMALLINT;
ALTER TABLE ARTICLES ADD MARGE DECIMAL(14,6);
CREATE PROCEDURE "GET_LAST_DPA"
(
"INDX" INTEGER
)
RETURNS
(
"DPA" DECIMAL(12, 2)
)
AS
BEGIN
FOR SELECT DPA FROM ARTFOUR WHERE INDXART=:INDX AND DPA>0 ORDER BY DATEACHAT INTO :DPA DO
begin
end
SUSPEND;
END
;
CREATE PROCEDURE "GET_PMPA"
(
"INDX" INTEGER
)
RETURNS
(
"PMPA" DECIMAL(12, 2)
)
AS
DECLARE VARIABLE PRIX DECIMAL(14,6);
DECLARE VARIABLE QUANTITE DECIMAL(11,2);
DECLARE VARIABLE REMISE DECIMAL(5,2);
DECLARE VARIABLE OLD_PMPA DECIMAL(12,2);
DECLARE VARIABLE NOMBRE DECIMAL(14,6);
DECLARE VARIABLE CDA DECIMAL(11,2);
DECLARE VARIABLE TOTALPA DECIMAL(14,4);
BEGIN
TOTALPA=0;
NOMBRE=0;
/* Selectionner factures achat */
FOR SELECT PRIX,QUANTITE,REMISE FROM LIGNES L
JOIN PIECES P ON P.INDX=l.INDEXPIECE AND TYPEPIECE=14
WHERE INDEXARTICLE=:INDX
AND QUANTITE IS NOT NULL
AND QUANTITE>0
INTO :PRIX,:QUANTITE,:REMISE DO
BEGIN
SELECT MAX(LOT) FROM ARTFOUR WHERE DPA=:PRIX AND INDXART=:INDX INTO CDA;
IF ((CDA IS NOT NULL) AND (CDA>0)) THEN PRIX = PRIX / CDA;
IF ((REMISE IS NOT NULL) AND (REMISE<>0)) THEN PRIX = PRIX * (100 - REMISE) / 100;
TOTALPA = TOTALPA + (PRIX * QUANTITE);
NOMBRE = NOMBRE + QUANTITE;
END
IF (NOMBRE=0) THEN SELECT DPA FROM GET_LAST_DPA(:INDX) INTO :PMPA;
ELSE PMPA = TOTALPA / NOMBRE;
SELECT PMPA FROM ARTICLES WHERE INDX=:INDX INTO :OLD_PMPA;
IF (PMPA<>OLD_PMPA) THEN UPDATE ARTICLES SET PMPA=:PMPA WHERE INDX=:INDX;
SUSPEND;
END
;
CREATE PROCEDURE "GET_MARGE_LIGNE"
(
"INDEX_PIECE" INTEGER,
"NO_LIGNE" SMALLINT
)
RETURNS
(
"MARGE" DECIMAL(14, 6)
)
AS
DECLARE VARIABLE INDXA INTEGER;
DECLARE VARIABLE PRIX DECIMAL(14,6);
DECLARE VARIABLE QUANTITE DECIMAL(11,2);
DECLARE VARIABLE REMISE DECIMAL(5,2);
DECLARE VARIABLE DPAU DECIMAL(14,4);
DECLARE VARIABLE PMPA DECIMAL(14,4);
DECLARE VARIABLE MARGE_L DECIMAL(14,4);
DECLARE VARIABLE MARGE_A DECIMAL(14,4);
DECLARE VARIABLE TYPE_MARGE SMALLINT;
BEGIN
SELECT L.INDEXARTICLE,L.PRIX,L.QUANTITE,L.REMISE,L.MARGE,A.DPAUHT,A.PMPA,A.TYPEMARGE,A.MARGE FROM LIGNES L
JOIN ARTICLES A ON A.INDX=L.INDEXARTICLE
WHERE L.INDEXPIECE=:INDEX_PIECE AND L.NOLIGNE=:NO_LIGNE
INTO :INDXA,:PRIX,:QUANTITE,:REMISE,:MARGE_L,:DPAU,:PMPA,:TYPE_MARGE,:MARGE_A;
/* Si pas d'article, pas de calcul */
IF (MARGE_L IS NULL) THEN MARGE=0;
/*L.PRIX*L.QUANTITE*(10000+L.TVA-(L.REMISE*100))/10000*/
IF (INDXA IS NULL) THEN MARGE=0;
ELSE
BEGIN
IF (TYPE_MARGE=2) THEN MARGE=:MARGE_A;
ELSE
BEGIN
IF (TYPE_MARGE IS NULL OR TYPE_MARGE<>1) THEN
BEGIN
IF (PMPA IS NULL) THEN SELECT PMPA FROM GET_PMPA(:INDXA) INTO :DPAU;
ELSE DPAU = PMPA;
END
/* DPAU contient le prix d'achat . Soustraire le prix de vente */
END
IF ((REMISE IS NOT NULL) AND (REMISE<>0)) THEN PRIX = PRIX * (100 - REMISE) / 100;
MARGE = (PRIX - DPAU) * QUANTITE;
END
IF (MARGE_L IS NULL OR MARGE_L<>MARGE) THEN UPDATE LIGNES SET MARGE=:MARGE WHERE INDEXPIECE=:INDEX_PIECE AND NOLIGNE=:NO_LIGNE;
SUSPEND;
END
;
CREATE PROCEDURE "GET_MARGE_PIECE"
(
"INDEX_PIECE" INTEGER
)
RETURNS
(
"MARGE" DECIMAL(14, 6)
)
AS
DECLARE VARIABLE NOLIGNE SMALLINT;
DECLARE VARIABLE MARGE1 DECIMAL(14,4);
BEGIN
MARGE = 0;
FOR SELECT NOLIGNE FROM LIGNES WHERE INDEXPIECE=:INDEX_PIECE INTO :NOLIGNE DO
BEGIN
SELECT MARGE FROM GET_MARGE_LIGNE(:INDEX_PIECE,:NOLIGNE) INTO :MARGE1;
IF (MARGE1 IS NOT NULL) THEN MARGE = MARGE + MARGE1;
END
SUSPEND;
END
;
CREATE PROCEDURE "MAJ_DPA"
(
INDXART INTEGER,
DPA1 DECIMAL(14,4),
LOT DECIMAL(11,2)
)
AS
DECLARE VARIABLE DPA2 DECIMAL(14,4);
BEGIN
IF ((LOT IS NOT NULL) AND (LOT>0)) THEN DPA1=DPA1 / LOT;
SELECT DPAUHT FROM ARTICLES WHERE INDX=:INDXART INTO :DPA2;
IF (DPA1<>DPA2) THEN UPDATE ARTICLES SET DPAUHT=:DPA1 WHERE INDX=:INDXART;
EXIT;
END
;
CREATE TRIGGER "INS_ARTFOUR" FOR "ARTFOUR"
ACTIVE AFTER INSERT POSITION 0
as
begin
EXECUTE PROCEDURE MAJ_DPA(new."INDXART",NEW."DPA",new."LOT");
end
;
CREATE TRIGGER "UPD_ARTFOUR" FOR "ARTFOUR"
ACTIVE AFTER UPDATE POSITION 0
as
begin
IF ((new."DPA"<>OLD."DPA") OR (new."LOT"<>old."LOT")) THEN EXECUTE PROCEDURE MAJ_DPA(new."INDXART",NEW."DPA",new."LOT");
end
;
DECLARE EXTERNAL FUNCTION abs
DOUBLE PRECISION
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';
ALTER TABLE RAYONS ADD CPTIMPORT VARCHAR(15);
UPDATE RAYONS SET CPTVENTE='700000';
UPDATE RAYONS SET CPTACHAT='600000';
UPDATE RAYONS SET CPTIMPORT='607050';
UPDATE RAYONS SET CPTEXPORT='707050';
commit;
DECLARE EXTERNAL FUNCTION substrlen
CSTRING(32000), SMALLINT, SMALLINT
RETURNS CSTRING(255) FREE_IT
ENTRY_POINT 'IB_UDF_substrlen' MODULE_NAME 'ib_udf';
CREATE PROCEDURE "INTERROGATION_PONTV"
(
"DATEDEB" DATE,
"DATEFIN" DATE,
"DETAIL_VERSEMENTS" SMALLINT,
"DETAIL_TVA" SMALLINT,
"DETAIL_TVA_PORT" SMALLINT,
"DETAIL_HT" SMALLINT
)
RETURNS
(
"DATEPIECE" TIMESTAMP,
"NOPIECE" VARCHAR(15),
"NOLIGNE" SMALLINT,
"INFO1" VARCHAR(15),
"INFO2" VARCHAR(15),
"LIBELLE" VARCHAR(85),
"DEBIT" DECIMAL(12, 2),
"CREDIT" DECIMAL(12, 2),
"ESTPAYE" CHAR(1),
"ESTESP" CHAR(1)
)
AS
DECLARE VARIABLE TTC DECIMAL(12,2);
DECLARE VARIABLE M1 DECIMAL(12,2);
DECLARE VARIABLE TVA DECIMAL(12,2);
DECLARE VARIABLE HT DECIMAL(12,2);
DECLARE VARIABLE INDX INTEGER;
DECLARE VARIABLE NOTIERS INTEGER;
DECLARE VARIABLE ST VARCHAR(200);
DECLARE VARIABLE TYPEPIECE VARCHAR(35);
DECLARE VARIABLE TYPEVERS VARCHAR(35);
DECLARE VARIABLE TAUX DECIMAL(6,2);
DECLARE VARIABLE TAUXTVA INTEGER;
DECLARE VARIABLE TVAPORT INTEGER;
DECLARE VARIABLE PORT DECIMAL(12,2);
DECLARE VARIABLE I INTEGER;
BEGIN
FOR SELECT P.INDX,P.DATEPIECE,P.NOPIECE,P.TOTALHT,P.TOTALTVA,P.TOTALTTC,P.NOTIERS,P.TVAPORT,P.PORT,
T.COMPTGENE,T.COMPTAUXI,C.DESIGNATION
FROM PIECES P
LEFT JOIN CLIENTS T ON T.INDX=P.NOTIERS
LEFT JOIN CHAINES C on (c.TYPEC=0) AND (c.LIGNE=p.TYPEPIECE) AND (C.COLONNE=0)
WHERE P.TOTALTTC<>0 AND P.DATEPONT IS NULL AND P.DATEPIECE>=:DATEDEB
AND P.DATEPIECE<=:DATEFIN AND Z<>0
ORDER BY P.DATEPIECE
INTO :INDX,:DATEPIECE,:NOPIECE,:HT,:TVA,:TTC,:NOTIERS,:TVAPORT,:PORT,
:INFO1,:INFO2,:TYPEPIECE DO
BEGIN
NOLIGNE=1;
IF (INFO1 IS NULL OR INFO1='') THEN INFO1='411000';
SELECT SUM(MONTANT) FROM VERSEMENTS WHERE INDEXPIECE=:INDX INTO :M1;
IF (TTC=M1) THEN ESTPAYE = 'O'; ELSE ESTPAYE = 'N';
SELECT SUM(MONTANT) FROM VERSEMENTS WHERE INDEXPIECE=:INDX AND TYPEV=0 INTO :M1;
IF (TTC=M1) THEN ESTESP = 'O'; ELSE ESTESP = 'N';
IF (NOTIERS>0) THEN SELECT AVALUE FROM GET_NOM_CLIENT(:NOTIERS) INTO :ST;
ELSE ST = 'N░ ' || NOPIECE;
/* LIGNE 1 (Montant TTC) */
IF (DETAIL_VERSEMENTS<>0) THEN
BEGIN
/* DΘtailler les versements */
FOR SELECT C.DESIGNATION,V.MONTANT FROM VERSEMENTS V
LEFT JOIN CHAINES C on (c.TYPEC=22) AND (c.LIGNE=V.TYPEV) AND (C.COLONNE=0)
WHERE V.INDEXPIECE=:INDX AND V.MONTANT<>0
ORDER BY V.DATEV
INTO :TYPEVERS,:M1 DO
BEGIN
TTC = TTC-M1;
CREDIT=NULL;
DEBIT=NULL;
IF (M1<0) THEN CREDIT=-M1; ELSE DEBIT=M1;
LIBELLE = TYPEVERS || ' ' || TYPEPIECE || ' ' || ST;
SUSPEND;
END
END
CREDIT=NULL;
DEBIT=NULL;
IF(TTC<>0) THEN
BEGIN
LIBELLE = TYPEPIECE || ' ' || ST;
IF (TTC<0) THEN CREDIT=-TTC; ELSE DEBIT=TTC;
SUSPEND;
END
/*
* LIGNE 2
* (TVA)
*/
NOLIGNE=2;
INFO1 = '445710';
IF (DETAIL_TVA<>0 AND TVA<>0) THEN
BEGIN
FOR SELECT TVA,SUM(l.PRIX*l.QUANTITE*((100-L.REMISE)/100)*TVA/10000) FROM LIGNES L
WHERE INDEXPIECE=:INDX AND TVA<>0
GROUP BY TVA INTO :TAUXTVA,:M1 DO
BEGIN
CREDIT=NULL;
DEBIT=NULL;
/* Tva sur Port */
IF (DETAIL_TVA_PORT=0 AND TAUXTVA=TVAPORT AND PORT<>0) THEN
BEGIN
M1 = M1 + (PORT * TVAPORT /10000);
TVAPORT = 0;
END
/* IF ( (TVA>M1 AND (TVA-M1)<0.02) OR (TVA<M1 AND (M1-TVA)<0.02)) THEN M1=TVA;*/
IF (ABS(TVA-M1)<0.03) THEN M1=TVA;
LIBELLE = 'TVA ' || CAST(CAST(TAUXTVA AS DECIMAL(6,2)) / 100 AS VARCHAR(8)) || '%';
TVA = TVA - M1;
IF (M1>0) THEN CREDIT=M1; ELSE DEBIT=-M1;
INFO2 = TAUXTVA;
SUSPEND;
END
END
/* Cas rare= Port taxΘ sur une piΦce HT */
IF (TVAPORT<>0 AND PORT<>0) THEN
BEGIN
M1 = PORT * TVAPORT /10000;
TVAPORT = 0;
LIBELLE = 'TVA ' || CAST(CAST(TAUXTVA AS DECIMAL(6,2)) / 100 AS VARCHAR(8)) || '%';
IF (ABS(TVA-M1)<0.03) THEN M1=TVA;
TVA = TVA - M1;
IF (M1>0) THEN CREDIT=M1; ELSE DEBIT=-M1;
INFO2 = 'PORT';
SUSPEND;
END
/* Le reste de la TVA */
IF (TVA<>0) THEN
BEGIN
CREDIT=NULL;
DEBIT=NULL;
LIBELLE = 'TVA';
IF (TVA>0) THEN CREDIT=TVA; ELSE DEBIT=-TVA;
SUSPEND;
END
/*
* LIGNE 3
* (LIGNES DE FACTURE HT)
*/
NOLIGNE=3;
INFO2 = '';
FOR SELECT SUBSTRLEN(D.TEXTE,1,85),l.PRIX*l.QUANTITE*((100-L.REMISE)/100) AS TOT,L.TVA,R.CPTVENTE,R.CPTEXPORT
FROM LIGNES L
LEFT JOIN ARTICLES A ON A.INDX=L.INDEXARTICLE
LEFT JOIN DESIGNATIONS D ON D.INDXART=L.INDEXARTICLE AND D.CODELANGUE=1
LEFT JOIN RAYONS R ON R.PKEY=A.PKEYR
WHERE L.INDEXPIECE=:INDX AND PRIX<>0 AND QUANTITE<>0
ORDER BY 2 DESC
INTO :LIBELLE,:M1,:TAUXTVA,:INFO1,:ST DO IF (HT<>0) THEN
BEGIN
CREDIT=NULL;
DEBIT=NULL;
IF (TAUXTVA=0) THEN INFO1 = ST;
IF ((DETAIL_HT=0) OR (ABS(HT-M1)<0.03)) THEN M1 = HT;
HT = HT - M1;
IF (M1>0) THEN CREDIT=M1; ELSE DEBIT=-M1;
SUSPEND;
END
IF (HT<>0) THEN
/* ProblΦme d'arrondi */
BEGIN
CREDIT=NULL;
DEBIT=NULL;
LIBELLE = 'Arrondi sur HT';
INFO2 = 'ARRONDI';
IF (HT>0) THEN CREDIT=HT; ELSE DEBIT=-HT;
SUSPEND;
END
END
END
;
CREATE PROCEDURE "INTERROGATION_PONTA"
(
"DATEDEB" DATE,
"DATEFIN" DATE,
"DETAIL_VERSEMENTS" SMALLINT,
"DETAIL_TVA" SMALLINT,
"DETAIL_TVA_PORT" SMALLINT,
"DETAIL_HT" SMALLINT
)
RETURNS
(
"DATEPIECE" TIMESTAMP,
"NOPIECE" VARCHAR(15),
"NOLIGNE" SMALLINT,
"INFO1" VARCHAR(15),
"INFO2" VARCHAR(15),
"LIBELLE" VARCHAR(85),
"DEBIT" DECIMAL(12, 2),
"CREDIT" DECIMAL(12, 2),
"ESTPAYE" CHAR(1),
"ESTESP" CHAR(1)
)
AS
DECLARE VARIABLE TTC DECIMAL(12,2);
DECLARE VARIABLE M1 DECIMAL(12,2);
DECLARE VARIABLE TVA DECIMAL(12,2);
DECLARE VARIABLE HT DECIMAL(12,2);
DECLARE VARIABLE INDX INTEGER;
DECLARE VARIABLE NOTIERS INTEGER;
DECLARE VARIABLE ST VARCHAR(200);
DECLARE VARIABLE TYPEPIECE VARCHAR(35);
DECLARE VARIABLE TYPEVERS VARCHAR(35);
DECLARE VARIABLE TAUX DECIMAL(6,2);
DECLARE VARIABLE TAUXTVA INTEGER;
DECLARE VARIABLE TVAPORT INTEGER;
DECLARE VARIABLE PORT DECIMAL(12,2);
DECLARE VARIABLE I INTEGER;
BEGIN
FOR SELECT P.INDX,P.DATEPIECE,P.NOPIECE,P.TOTALHT,P.TOTALTVA,P.TOTALTTC,P.NOTIERS,P.TVAPORT,P.PORT,
T.COMPTGENE,T.COMPTAUXI,C.DESIGNATION
FROM PIECES P
LEFT JOIN CLIENTS T ON T.INDX=P.NOTIERS
LEFT JOIN CHAINES C on (c.TYPEC=0) AND (c.LIGNE=p.TYPEPIECE) AND (C.COLONNE=0)
WHERE P.TOTALTTC<>0 AND P.DATEPONT IS NULL AND P.DATEPIECE>=:DATEDEB
AND P.DATEPIECE<=:DATEFIN AND TYPEPIECE IN (13,14)
ORDER BY P.DATEPIECE
INTO :INDX,:DATEPIECE,:NOPIECE,:HT,:TVA,:TTC,:NOTIERS,:TVAPORT,:PORT,
:INFO1,:INFO2,:TYPEPIECE DO
BEGIN
NOLIGNE=1;
IF (INFO1 IS NULL OR INFO1='') THEN INFO1='401000';
SELECT SUM(MONTANT) FROM VERSEMENTS WHERE INDEXPIECE=:INDX INTO :M1;
IF (TTC=M1) THEN ESTPAYE = 'O'; ELSE ESTPAYE = 'N';
SELECT SUM(MONTANT) FROM VERSEMENTS WHERE INDEXPIECE=:INDX AND TYPEV=0 INTO :M1;
IF (TTC=M1) THEN ESTESP = 'O'; ELSE ESTESP = 'N';
IF (NOTIERS>0) THEN SELECT AVALUE FROM GET_NOM_CLIENT(:NOTIERS) INTO :ST;
ELSE ST = 'N░ ' || NOPIECE;
/* LIGNE 1 (Montant TTC) */
IF (DETAIL_VERSEMENTS<>0) THEN
BEGIN
/* DΘtailler les versements */
FOR SELECT C.DESIGNATION,V.MONTANT FROM VERSEMENTS V
LEFT JOIN CHAINES C on (c.TYPEC=22) AND (c.LIGNE=V.TYPEV) AND (C.COLONNE=0)
WHERE V.INDEXPIECE=:INDX AND V.MONTANT<>0
ORDER BY V.DATEV
INTO :TYPEVERS,:M1 DO
BEGIN
TTC = TTC-M1;
CREDIT=NULL;
DEBIT=NULL;
IF (M1>0) THEN CREDIT=M1; ELSE DEBIT=-M1;
LIBELLE = TYPEVERS || ' ' || TYPEPIECE || ' ' || ST;
SUSPEND;
END
END
CREDIT=NULL;
DEBIT=NULL;
IF(TTC<>0) THEN
BEGIN
LIBELLE = TYPEPIECE || ' ' || ST;
IF (TTC>0) THEN CREDIT=TTC; ELSE DEBIT=-TTC;
SUSPEND;
END
/*
* LIGNE 2
* (TVA)
*/
NOLIGNE=2;
INFO1 = '445660';
IF (DETAIL_TVA<>0 AND TVA<>0) THEN
BEGIN
FOR SELECT TVA,SUM(l.PRIX*l.QUANTITE*((100-L.REMISE)/100)*TVA/10000) FROM LIGNES L
WHERE INDEXPIECE=:INDX AND TVA<>0
GROUP BY TVA INTO :TAUXTVA,:M1 DO
BEGIN
CREDIT=NULL;
DEBIT=NULL;
/* Tva sur Port */
IF (DETAIL_TVA_PORT=0 AND TAUXTVA=TVAPORT AND PORT<>0) THEN
BEGIN
M1 = M1 + (PORT * TVAPORT /10000);
TVAPORT = 0;
END
IF (ABS(TVA-M1)<0.03) THEN M1=TVA;
LIBELLE = 'TVA ' || CAST(CAST(TAUXTVA AS DECIMAL(6,2)) / 100 AS VARCHAR(8)) || '%';
TVA = TVA - M1;
IF (M1<0) THEN CREDIT=-M1; ELSE DEBIT=M1;
INFO2 = TAUXTVA;
SUSPEND;
END
END
/* Cas rare= Port taxΘ sur une piΦce HT */
IF (TVAPORT<>0 AND PORT<>0) THEN
BEGIN
M1 = PORT * TVAPORT /10000;
TVAPORT = 0;
IF (ABS(TVA-M1)<0.03) THEN M1=TVA;
LIBELLE = 'TVA ' || CAST(CAST(TAUXTVA AS DECIMAL(6,2)) / 100 AS VARCHAR(8)) || '%';
TVA = TVA - M1;
IF (M1<0) THEN CREDIT=-M1; ELSE DEBIT=M1;
INFO2 = 'PORT';
SUSPEND;
END
/* Le reste de la TVA */
IF (TVA<>0) THEN
BEGIN
CREDIT=NULL;
DEBIT=NULL;
LIBELLE = 'TVA';
IF (TVA<0) THEN CREDIT=-TVA; ELSE DEBIT=TVA;
SUSPEND;
END
/*
* LIGNE 3
* (LIGNES DE FACTURE HT)
*/
NOLIGNE=3;
INFO2 = '';
FOR SELECT SUBSTRLEN(D.TEXTE,1,85),l.PRIX*l.QUANTITE*((100-L.REMISE)/100) AS TOT,L.TVA,R.CPTVENTE,R.CPTEXPORT
FROM LIGNES L
LEFT JOIN ARTICLES A ON A.INDX=L.INDEXARTICLE
LEFT JOIN DESIGNATIONS D ON D.INDXART=L.INDEXARTICLE AND D.CODELANGUE=1
LEFT JOIN RAYONS R ON R.PKEY=A.PKEYR
WHERE L.INDEXPIECE=:INDX AND PRIX<>0 AND QUANTITE<>0
ORDER BY 2 DESC
INTO :LIBELLE,:M1,:TAUXTVA,:INFO1,:ST DO IF (HT<>0) THEN
BEGIN
CREDIT=NULL;
DEBIT=NULL;
IF (TAUXTVA=0) THEN INFO1 = ST;
IF ((DETAIL_HT=0) OR (ABS(HT-M1)<0.03)) THEN M1 = HT;
HT = HT - M1;
IF (M1<0) THEN CREDIT=-M1; ELSE DEBIT=M1;
SUSPEND;
END
IF (HT<>0) THEN
/* ProblΦme d'arrondi */
BEGIN
CREDIT=NULL;
DEBIT=NULL;
LIBELLE = 'Arrondi sur HT';
INFO2 = 'ARRONDI';
IF (HT<0) THEN CREDIT=-HT; ELSE DEBIT=HT;
SUSPEND;
END
END
END
;
SET GENERATOR VERSION_BASE TO 73;